--------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  X:\shared\ambulance\Work\replicationpackage\logs\litigation_trends.log
  log type:  text
 opened on:  13 Jul 2024, 07:49:07

. 
. /*******************************************************************************
> litigation_trends.do
> 
> Produces figures of raw trends for districts subject to litigation
> *******************************************************************************/
. 
. clear all

. 
. qui {

. 
. local alphabet " a b c d e f g h i j k l m n "

. tokenize "`alphabet'"

. 
. local counter=1

. foreach d of local dates {
  2.         if `d'>516 & `d'<695 {
  3.                 qui su crimdate if civdate==`d'
  4.                 if `r(N)'==0 {
  5.                         local crim = 50000
  6.                 }
  7.                 if `r(N)'>0 {
  8.                         local crim =`r(mean)'
  9.                         if `crim'<516 {
 10.                                 local crim = 50000
 11.                         }
 12.                 }
 13.                 qui su PAdate if civdate==`d'
 14.                 if `r(N)'==0 {
 15.                         local PA = 50000
 16.                 }
 17.                 if `r(N)'>0 {
 18.                         local PA=`r(mean)'
 19.                 }
 20.                 twoway (line pmt_ht month_date if civdate==`d'), ///
>                         xline(`PA') xline(`d', lc(forest_green) lpatt(-)) ///
>                         xline(`crim', lc(dkorange) lpatt(_)) ///
>                         xti(" ") yti("Monthly Ambulance Payments ($100,000)") ///
>                         xlab(516 "2003" 552 "2006" 588 "2009" 624 "2012" 660 "2015" 696 "2018") ///
>                         ylab(, format(%9.0gc)) ///
>                         leg(off) graphregion(color(white)) bgcolor(white)
 21.                 qui graph export "${outpath}Figure_A2``counter''.pdf", as(pdf) replace // Figure A2
 22.                 local crim = 50000
 23.                 local PA = 50000
 24.                 
.                 local counter=`counter'+1
 25.         }
 26. }

. 
. sort crimdate month_date

. qui levelsof crimdate, local(dates)

. 
. local counter=1

. foreach d of local dates {
  2.         if `d'>516 & `d'<695 {
  3.                 qui su civdate if crimdate==`d'
  4.                 if `r(N)'==0 {
  5.                         local civ = 50000
  6.                 }
  7.                 if `r(N)'>0 {
  8.                         local civ=`r(mean)'
  9.                         if `civ'<516 {
 10.                                 local civ = 50000
 11.                         }
 12.                 }
 13.                 qui su PAdate if crimdate==`d'
 14.                 if `r(N)'==0 {
 15.                         local PA = 50000
 16.                 }
 17.                 if `r(N)'>0 {
 18.                         local PA=`r(mean)'
 19.                 }
 20.                 twoway (line pmt_ht month_date if crimdate==`d'), ///
>                         xline(`PA') xline(`civ', lc(forest_green) lpatt(-)) ///
>                         xline(`d', lc(dkorange) lpatt(_)) ///
>                         xti(" ") yti("Monthly Ambulance Payments ($100,000)") ///
>                         xlab(516 "2003" 552 "2006" 588 "2009" 624 "2012" 660 "2015" 696 "2018") ///
>                         ylab(, format(%9.0gc)) ///
>                         leg(off) graphregion(color(white)) bgcolor(white)
 21.                 qui graph export "${outpath}Figure_A3``counter''.pdf", as(pdf) replace // Figure A3
 22.                 local civ = 50000
 23.                 local PA = 50000
 24.                 
.                 local counter=`counter'+1               
 25.         }
 26. }

. 
. log close
      name:  <unnamed>
       log:  X:\shared\ambulance\Work\replicationpackage\logs\litigation_trends.log
  log type:  text
 closed on:  13 Jul 2024, 07:49:21
--------------------------------------------------------------------------------------------------------------------------------------------------------
